<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ taglib uri="ctp-tag" prefix="ctp" %> 
<%@page import="java.util.ArrayList"%>
<%--
<ANNOTATION.PAGE>
<fileName> index1.jsp </fileName>
<author> kfzx-daiyf </author>
<createDate> 2010-5-4 下午06:23:28 </createDate>
<lastModifier> 2010-5-4 下午06:23:28 </lastModifier>
<lastModifyDate> 2010-5-4 下午06:23:28 </lastModifyDate>
<description>数据表格</Description>
</ANNOTATION.PAGE>
--%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<%@ include file="/uniform_attestation/head_beforesignon.jsp"%>
<title><ctp:label key="title"/></title>
<%
String ssicFlag = "";
if (enableSSIC.equals("true"))
{
	ssicFlag = "1";
}
else
{
	ssicFlag = "0";
}
String ctpLoginUrl=request.getParameter("ctpLoginUrl");
String ctpLoginItem=request.getParameter("ctpLoginItem");
%>
<ctp:include items='pictureshow,messagebox,statusbar'/>
<script type="text/javascript" src="<ctp:out name='fullPath'/>js/changeskins.js"></script>
<style type="text/css">
	/* CSS reset begin*/
	body{font:14px Tahoma,Helvetica,"宋体",san-serif;background-color:white;}
	body,div,p,form,ul,ol,li,dl,dt,dd,h1,h2,h3,h4,h5,h6,input
	span{margin:0;padding:0;}
	img{border:0;}
	ul,ol{list-style:none;}
	table {
	    border-collapse:collapse;
	    border-spacing:0;
	}
	a:link,a:visited{color:#333333;text-decoration:none;}
	a:hover {
	    color: #FF7112;
	}
	a:active {
	    text-decoration: none;
	}
	/* CSS reset end*/

	html{
		dbackground:white url("<ctp:out name='fullPath' />/images/icbcbg.gif") repeat	
		background:white;
	}

	#container{
		position:relative;
		width:960px;
		margin:0 auto;
		overflow:auto;
		background-color:#fff;
	}
	#header{
		width:880px;
		height:50px;
		margin:10px auto 0 auto;
	}
	#logo img{
		position:absolute;
		height:50px;
	}
	
	#head_info{
		position:absolute;
		width:300px;	
		left:620px;
		text-align: right;
		padding:5px 0;
		color:#333;
	}
	
	#main{
		position:relative;
		overflow:hidden;
		width:880px;
		margin:20px auto 0 auto;
		padding-bottom:20px;
		border-top:2px solid #5499ff;
	}
	#main_top{
		position:relative;
	}
	
	#main_left{
		position:relative;
		float:left;
		overflow:auto;
		width:500px;
		dheight:300px;
		padding:30px 50px 30px 50px;
		background:url("<ctp:out name='fullPath'/>/images/loginBg_l.gif") no-repeat 100% 50%;
		line-height:2;
		color:#333;
	}
	
	#main_right{
		position:relative;
		top:70px;
		overflow:hidden;
		width:256px;
		margin-right:20px;
		dborder:1px solid red;
	}
	
	#main_bottom{
		position:relative;
		clear:both;
		width:870px;
		background-color:#cee4f4;
		padding:5px;
		text-align: center;
	}
	
	#main_bottom a{
		display:inline-block;
		padding:0 10px;	
	}
	
	#footer{
		position:relative;
		width:880px;
		margin:0 auto 20px auto;
		text-align: right;
   		border-top: 1px solid #ddd; 
   		color: #AAA; 
   		padding-top: 1px; 
   		font-style: italic;
	}
	
	#copyright{
		font-size:12px;
	}
	
	#login_info li{
		margin-top:10px;	
		color:#535353;
	}
	
	.login_left{
		display:inline-block;
		width:60px;
		vertical-align:bottom;
		text-align:right;
	}
	#login_act{
		width:100%;
		text-align:center;
		margin-top:25px;	
	}
	legend{
		color:#0046d5;	
	}
	input{
		width:150px;
	}
	select{
		width:150px;	
		text-align:center;
	}
	option{
		text-align:center;
	}
	a{font-size:12px;}
	a:link,a:visited{color: #999;}
	a:hover {color:#00f;text-decoration:underline;}
	
	#login_button{
		cursor:pointer;
	}
</style>
<script type='text/javascript' language="javascript">
        var jsonData;
//		var waitImg="<ctp:out name='fullPath'/>images/"+GetCookie("save_skin")+"/statusbar/progress.gif";
//		var waitImgFull="<ctp:out name='fullPath'/>images/"+GetCookie("save_skin")+"/statusbar/progress_full.gif";
		if(ctp.core.lang && ctp.core.lang() =="zh-CN"){
//			document.write("<div id='SYS_LOADING' style='height:100%;width:100%;background-color:#ffffff;'><div style='font-weight:bold;width:100%;color:gray;text-align:center;top:"+parseInt(document.documentElement.clientHeight/2)+"px;position:absolute;'><img id='waitingbar' src='"+waitImg+"' style='vertical-align:middle'/><br/>系统加载中，请稍候...</div></div>");
		    jsonData = {
			'picList':[

			   {"src":"<ctp:out name='fullPath' />images/datangwealth.jpg","text":"大唐财富投资管理有限公司"}
			],
			'btnContent':[				
			 	{"src":"<ctp:out name='fullPath' />images/datangwealth.jpg"}
			]			
		   };
		}
		else
		{
//			document.write("<div id='SYS_LOADING' style='height:100%;width:100%;background-color:#ffffff;'><div style='font-weight:bold;width:100%;color:gray;text-align:center;top:"+parseInt(document.documentElement.clientHeight/2)+"px;position:absolute;'><img id='waitingbar' src='"+waitImg+"' style='vertical-align:middle'/>System is loading , please wait ...</div></div>");
		   jsonData = {
		    'picList':[
			   {"src":"<ctp:out name='fullPath' />images/logon/ctpCore.jpg","text":"Super CTP core"},
			   {"src":"<ctp:out name='fullPath' />images/logon/sysManagement.jpg","text":"New system management"},
			   {"src":"<ctp:out name='fullPath' />images/logon/uiEdit.jpg","text":"Development with IDE plugins"},
			   {"src":"<ctp:out name='fullPath' />images/logon/uiWeb.jpg","text":"Many kinds of Web UI plugins"}			
			],
			'btnContent':[			
			 	{"src":"<ctp:out name='fullPath' />images/logon/ctpCore.jpg"},
				{"src":"<ctp:out name='fullPath' />images/logon/sysManagement.jpg"},
				{"src":"<ctp:out name='fullPath' />images/logon/uiEdit.jpg"},
				{"src":"<ctp:out name='fullPath' />images/logon/uiWeb.jpg"}
			]			
		   };
		}
		
		 
	$(function(){		
		if(CTP_WEB_LANG&&CTP_WEB_LANG=="en_US"){
			//$("select[name='Language']")[0].selectedIndex=1;
			$("select[name='Language'] option[value='en_US']").attr("selected",true);
		}
		if(CTP_WEB_LANG&&CTP_WEB_LANG=="zh_CN"){
		       $("#login_button").attr("src","<ctp:out name='fullPath' />images/signin/login_button.jpg");
		}else{
		       $("#login_button").attr("src","<ctp:out name='fullPath' />images/signin/login_button1.jpg");
		}
	});
	function init(){			
		<%if(null!=ctpLoginItem && !"".equals(ctpLoginItem) && null!=ctpLoginUrl && !"".equals(ctpLoginUrl)){%> //以链接方式登陆
		    var uid = GetCookie("ctpuserId");//取cookie用户
		    var pwd = GetCookie("ctppw");//取cookie用户密码
	        if(uid!=""&&pwd!=""){			
	    	   document.form1.userId.value=uid;
	    	   document.form1.pw.value=pwd;	
	    	   submitForm();
	    	   return;//返回
	        }		   
	    <%}%>	
		new ctp.ui.pictureshow({
			data: jsonData,
			text: true,
			renderTo: 'main_left'
		});
		var $usernameInputObj = $('#login_info :input[name=userId]').keydown(function(e){
			if (e.keyCode == 13) {
				//$pwInputObj[0].focus();
				document.form1.pw_obj.focus();
			}
		});


		//配合安全规范改造   modify by kfzx-lvsx 20150106
		checkIESettings();
		
		$('#login_button').click(submitForm);
		//$("#waitingbar").attr("src", waitImgFull);
		//setTimeout(function(){
			$("#container").show();
			$("#SYS_LOADING").remove();
		//}, 10);
		
	}

	function checkIESettings(){
		//alert(serverName);
		/* var flag = GetCookie1("hasInitIESettings");
		if(flag !== "true"){
			//弹出提示执行脚本
			alert('<ctp:label key="trusted_site"/>');
			window.location.href = '<ctp:out name="fullPath"/>signin/ICBC_CTP.zip';
			//将flag置true放到cookie里头
			SetCookie1("hasInitIESettings", "true");
		} */
	}

	function pw_objKeyDownFunc(e){
		if (e.keyCode == 13) {
			submitForm();
		}
	}

	function DelCookie1(param){
	    var exp = new Date();
	    exp.setTime(exp.getTime() - 1);
	    var cval=GetCookie1(param);
	    if(cval!=null) document.cookie= param + "="+cval+";expires="+exp.toGMTString();
	}
	function SetCookie1(param,value) {
		/* var Days = 30000000;
		var exp  = new Date();
		exp.setTime(exp.getTime() + Days*24*60*60*1000);
		document.cookie = param + "="+ escape (value) + ";expires=" + exp.toGMTString(); */
	}
	function GetCookie1(param) {
		var arr = document.cookie.match(new RegExp("(^| )"+param+"=([^;]*)(;|$)"));
		if(arr != null) return unescape(arr[2]);
		return "";
	}

	function submitForm(){
		var userName = document.form1.userId;
		var password = document.getElementById("pw_obj").value;
		/* password = document.form1.pw_obj.CrpytPwd('C:\\Windows\\System32\\ICBC_CTP_1_00000_3DES_16');
		if(password === "encrypt_error" || password === "get_encrypt_entry_error"){
			//加密失败 或 获取加密算法入口失败
			alert('<ctp:label key="encrypt_failed"/>');
			window.location.href = '<ctp:out name="fullPath"/>signin/ICBC_CTP.zip';
			return ;
		}else if(password === "load_dll_error"){
			//加载动态库失败
			alert('<ctp:label key="install_dll_failed"/>');
			window.location.href = '<ctp:out name="fullPath"/>signin/ICBC_CTP.zip';
			return;
		}
		document.form1.pw.value = password; */
		//document.form1.pw.value = '111111';
		if(userName.value.length==0)
		{
			alert("<ctp:label key='insertmessage'/>");
			userName.focus();
			return;
		}
		 if(password.length==0)
		{
			alert("<ctp:label key='insertmessage'/>");
			document.form1.pw_obj.focus();
			return;
		} 
		DelCookie("ctpuserId");
		//DelCookie("ctppw");
		//SetCookie("ctpuserId",userName.value);//缓存用户,用于通过链接自动登陆用
		//SetCookie("ctppw",password.value);//缓存密码,用于通过链接自动登陆用
		document.form1.submit();
	}
		function changeLanguage(){
			top.CTP_WEB_LANG=document.form1.Language.value;
			//console.log('top.CTP_WEB_LANG:'+top.CTP_WEB_LANG);
		document.location.href="<ctp:out name='fullPath' />servlet/com.icbc.cte.cs.servlet.WithoutSessionReqServlet?Language="+document.form1.Language.value+"&flowActionName=changeLang&action=preparesignin.flowc";
	}
	
	function alertLink(){
		alert('<ctp:label key="linkArea" />');
	}
</script>
</head>  
<body onload="init()">
	<div id="container">
		<div id="header">
			<!--div id="logo"><img src="<ctp:out name='fullPath' />images/datangwealth.jpg" alt="大唐财富投资管理有限公司" /></div-->
			<div id="head_info"><ctp:dtFmt dateStyle="long" timeStyle="long" /></div>
		</div>
		<ctp:form name="form1" method="post" action="signin.flowc" flowActionName="process0">   
		<input name="ctpLoginUrl" id="ctpLoginUrl" type="hidden" value="<%=ctpLoginUrl%>" /> 
		<input name="ctpLoginItem" id="ctpLoginItem" type="hidden" value="<%=ctpLoginItem%>" /> 
		<div id="main">
			<div id="main_top">
				<div id="main_left">
<%-- 						<ctp:label key="ctp4_introduce"/> --%>
<%-- 						<ctp:label key="ctp4_introduce_info" /> --%>
				</div><div id="main_right">
					<fieldset><legend><ctp:label key="input_user_pw" /></legend>
					<div id="login_input">
						<ul id="login_info">
								<li><div><span id="login_user" class="login_left"><ctp:label key="user" /></span>
										<!--ctp:text name="userId" value="100101" onkeyup="checkSConfirmID('form1','userId','pw')" /-->
										<input name="userId" type="text" value="" style="width: 146px;" maxlength="40" />
									</div></li>
								<li><div><span id="login_pw" class="login_left"><ctp:label key="pwd" /></span>
										<!--ctp:password type="password" name="pw" value="111111" onkeyup="clickSubmit()" /-->
										<!-- input name="pw" type="password" value="111111" maxlength="40" /-->
										<!-- 使用密码控件 -->
<%-- 										<object onkeydown='pw_objKeyDownFunc(event);' id='pw_obj' width='148' height='22' vspace='1' classid='CLSID:fc0bff2d-47a5-0846-0147-a5084e8b000e' codebase='<ctp:out name="fullPath"/>signin/CTPCryp.CAB#version=1,0,0,00'></object> --%>
										<input id="pw_obj" type="password" name="pw" onkeydown='pw_objKeyDownFunc(event);'/>
									    <!--  ctp:hidden name="ssicFlag" value="0" /-->
									    <input name="ssicFlag" type="hidden" value="<%=ssicFlag %>" />
									    <input name="qwe" type="hidden" value="0" />
									    <ctp:hidden name="flowCtx.defaultRoleId" value="" />
									</div></li>
								<li><div><span id="login_lan" class="login_left"><ctp:label key="language"/></span>
										 <select name="Language" onchange="changeLanguage()">
									      <option selected value="zh_CN">中文</option>
									      <option value="en_US">English</option>
										</select>
										 </div>
								</li>
						</ul>
					</div>
					<div id="login_act">
						<img src="<ctp:out name='fullPath' />images/signin/login_button.jpg" alt="登录" id="login_button" />	
					</div>
					</fieldset>
				</div>				
			</div>
			<div id="main_bottom">
				<a href="#" onclick="alertLink()"><ctp:label key="usualLink" /></a>
			</div>
		</div>
		</ctp:form>
		<div id="footer"><p id="copyright">&copy;<ctp:label key="logo" /></p></div>
	</div>
	<script type='text/javascript'>$("#container").hide();</script>
</body>
</html>